package com.dyypdadmin.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dyypdadmin.pojo.ServiceRecords;
import org.apache.ibatis.annotations.*;

import java.util.Date;

@Mapper
public interface ServiceRecordsDao extends BaseMapper<ServiceRecords> {
    //新增服务记录
    @Insert("insert into servicerecords(user_id,order_number,pet_id,appointment_id,project_id,complete_time,status,is_medical) values (#{user_id},#{order_number},#{pet_id},#{appointment_id},#{project_id},now(),#{status},#{is_medical})")
    int addServiceRecord(@Param("user_id") int user_id, @Param("order_number") String order_number, @Param("pet_id") int pet_id, @Param("appointment_id") int appointment_id, @Param("project_id") int project_id, @Param("status") int status,@Param("is_medical") int is_medical);

    //update status when commit medicalrecord by record_id
    @Update("update servicerecords set status=4 where servicerecord_id=#{record_id}")
    int updateServiceRecordById(@Param("record_id")Integer record_id);

    @Select("select count(*) from servicerecords")
    int getServiceRecordsCounts();
}
